package com.niuwa.p2p.service.customer.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.niuwa.p2p.dao.customer.CertAuthDao;
import com.niuwa.p2p.dao.customer.CustSafetyProblemDao;
import com.niuwa.p2p.dao.customer.EmailAuthDao;
import com.niuwa.p2p.dao.customer.PhoneAuthDao;
import com.niuwa.p2p.entity.customer.CertAuth;
import com.niuwa.p2p.entity.customer.CustSafetyProblem;
import com.niuwa.p2p.entity.customer.EmailAuth;
import com.niuwa.p2p.entity.customer.PhoneAuth;
import com.niuwa.p2p.service.customer.ICustAuthService;

@Service
public class CustAuthServiceImpl implements ICustAuthService {
	
	@Autowired
	private PhoneAuthDao phoneAuthDao;	
	
	@Autowired
	private CertAuthDao certAuthDao;
	
	@Autowired
	private EmailAuthDao emailAuthDao;

	@Autowired
	private CustSafetyProblemDao custSafetyProblemDao;


	/**
	 * 身份认证【web】
	 * @param paramMap
	 * @return
	 */
	@Override
	public int certAuth(CertAuth certAuth) {
		return certAuthDao.insert(certAuth);
	}

	/**
	 * 邮箱认证【web】
	 * @param paramMap
	 * @return
	 */
	@Override
	public int emailAuth(EmailAuth emailAuth) throws Exception{
		return emailAuthDao.insertSelective(emailAuth);
	}

	/**
	 * 手机认证【web】
	 * @param paramMap
	 * @return
	 */
	@Override
	public int phoneAuth(PhoneAuth phoneAuth) {
		return phoneAuthDao.insertSelective(phoneAuth);
	}

	/**
     * 获取用户设置的密保问题[web]
     * @param custId
     * @return
     */
	@Override
	public CustSafetyProblem selectSafetyProblemByCustId(long custId) {
		return custSafetyProblemDao.selectSafetyProblemByCustId(custId);
	}

	/**
	 * 更改用户密保问题[web]
	 */
	@Override
	public int updateCustSafetyProblem(CustSafetyProblem record) {
		return custSafetyProblemDao.updateCustSafetyProblem(record);
	}

	@Override
	public int saveCustSafetyProblem(CustSafetyProblem record) {
		return custSafetyProblemDao.insertSelective(record);
	}
}
